<?php
// index.php
// Start working 21.JAN.2013 22:54:00

require_once('inc/mysql_connect.inc.php');

$title = "Working with Symbols &amp; Archetypes";
$variant = 0;

if(isset($_GET['id'])){
	require_once('object/article.ob.php');
	$article = new Article();
	$alias = strip_tags(trim($_GET['id']));
		if($alias=='intermarum') $alias = 'intermarium'; // a result of a Latin error :)
	$article->from_alias($alias);
	$title = $article->title;
	$variant = 1;
}
elseif(isset($_GET['profile'])){
	require_once('object/profile.ob.php');
	$profile = new Profile();
	$alias = strip_tags(trim($_GET['profile']));
	$profile->from_alias($alias);
	$title = $profile->name;
	$variant = 2;
}
elseif(isset($_GET['category'])){
	require_once('object/articlelist.ob.php');
	$catid = (int)($_GET['category']);
	$articlelist = new ArticleList('CATEGORY', '', $catid);
	$title = $articlelist->title;
	$variant = 3;
} 
elseif(isset($_GET['plist'])){
	require_once('object/profile.ob.php');
	$plist = strip_tags(trim($_GET['plist']));
	$profile = new Profile();
	$title = 'Persons'; // $profile->list_title; --- to improve
	$variant = 4;
}
else {
	require_once('object/articlelist.ob.php');
	$articlelist = new ArticleList();
}
include_once("inc/view_head.inc.php");
switch ($variant){
	/* case 0: 
		require_once('object/articlelist.ob.php');
		$articlelist = new ArticleList();
		echo $articlelist->show_content();
		break; */
	case 1: echo $article->show_content(); break;
	case 2: echo $profile->show_content(); /* echo '<p>In preparing.</p>' */  ; break;
	case 3: echo $articlelist->show_content(); break;
	case 4: echo $profile->show_list($plist); break;
	default: echo $articlelist->show_content();
}

include_once("inc/view_foot.inc.php");
?>